<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Webhook清单 - 多用户报警系统</title>
    {% load static %}
    <!-- Bootstrap CSS -->
    <link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="{% static 'font-awesome/css/font-awesome.min.css' %}" rel="stylesheet">
</head>
<body>
    <div class="container mt-4">
        <h1><i class="fa fa-plug" aria-hidden="true"></i> Webhook清单</h1>
        
        {% if user_webhooks %}
            <div class="table-responsive mt-4">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>Webhook名称</th>
                            <th>所属项目</th>
                            <th>渠道</th>
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for webhook in user_webhooks %}
                            <tr>
                                <td>{{ webhook.name }}</td>
                                <td><a href="{% url 'projects:project_detail' webhook.project.id %}">{{ webhook.project.name }}</a></td>
                                <td>{{ webhook.get_channel_display }}</td>
                                <td>
                                    {% if webhook.is_active %}
                                        <span class="badge bg-success">已激活</span>
                                    {% else %}
                                        <span class="badge bg-danger">已禁用</span>
                                    {% endif %}
                                </td>
                                <td>{{ webhook.created_at|date:"Y年m月d日 H:i" }}</td>
                                <td>
                                    <a href="{% url 'projects:project_detail' webhook.project.id %}#webhooks" class="btn btn-sm btn-primary" title="查看详情">
                                        <i class="fa fa-eye" aria-hidden="true"></i>
                                    </a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        {% else %}
            <p class="text-center text-muted mt-4">暂无Webhook数据</p>
        {% endif %}
    </div>

    <!-- Bootstrap JS -->
    <script src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
</body>
</html>